package com.google.code.kjug.guava.app;

import com.google.code.kjug.guava.app.data.OurDatabaseFakeout;
import com.google.code.kjug.guava.app.domain.Car;
import org.hamcrest.collection.IsIterableContainingInAnyOrder;
import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Ignore;
import org.junit.Test;

import java.util.Collection;

import static junit.framework.Assert.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;

public class Medium_UT {

    @Test
    @Ignore
    public void theSearchEngineShouldReturnAtLeastFiveCars() {
        SearchEngine searchEngine = new SearchEngine();
        searchEngine.setDatabase(new OurDatabaseFakeout());

        Collection<Car> cars = searchEngine.findCars();

        assertEquals(6, cars.size());
    }

    @Test
    @Ignore
    public void theSearchEngineCanReturnAListOfAllMakes() {
        SearchEngine searchEngine = new SearchEngine();
        searchEngine.setDatabase(new OurDatabaseFakeout());

        Collection<String> cars = searchEngine.listMakes();

        assertThat(cars, containsInAnyOrder("Jeep", "Honda", "BMW"));
    }

    @Test
    @Ignore
    public void theSearchEngineCanRetrieveCarListings() {
        SearchEngine searchEngine = new SearchEngine();
        searchEngine.setDatabase(new OurDatabaseFakeout());

        Collection<String> cars = searchEngine.findJustCars();

        assertThat(cars, containsInAnyOrder(
                "2009 BMW Z3",
                "2002 Honda Accord",
                "1994 Honda Prelude ... runs great!"));
    }

    @Test
    @Ignore
    public void theSearchEngineCanAlsoJustSearchCarsWithoutSUVs() {
        SearchEngine searchEngine = new SearchEngine();
        searchEngine.setDatabase(new OurDatabaseFakeout());

        Collection<String> cars = searchEngine.findJustCars();

        assertThat(cars, containsInAnyOrder("2009 BMW Z3", "2002 Honda Accord", "1994 Honda Prelude ... runs great!"));
    }

}
